package com.texplose.controller;

import com.texplose.entity.vo.ResponseResult;
import com.texplose.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : lyj
 * @Timer : 2022/5/17
 * @Description :
 */
@RestController
@RequestMapping("/category")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    @GetMapping
    public ResponseResult getRootCategory(){
        return categoryService.getRootCategory();
    }

    @GetMapping("/getCategoryList")
    public ResponseResult getCategoryList() {
        return categoryService.getCategoryList();
    }

    @GetMapping("/getChildrenById/{id}")
    public ResponseResult getChildrenById(@PathVariable("id")Integer id){
        return categoryService.getChildrenById(id);
    }

    @GetMapping("/getCategoryDetail/{id}")
    public ResponseResult getCategoryDetail(@PathVariable("id")Integer id){
        return categoryService.getCategoryDetail(id);
    }

    @GetMapping("/getCategoryPicker")
    public ResponseResult getCategoryPicker() {
        return categoryService.getCategoryPicker();
    }


}
